﻿using System;
using System.IO;

namespace ConsoleApp23
{
    class Program
    {
     

        static void Main(string[] args)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo("D:\\mySolo");
            directoryInfo.Create();
            string path = "D:\\mySolo\\test.txt";


            FileStream fs = File.Create(path);

            //获取文件信息
            Console.WriteLine("文件创建时间：" + File.GetCreationTime(path));
            Console.WriteLine("文件最后被写入时间：" + File.GetLastWriteTime(path));

            fs.Close();
            //创建StreamWriter 类的实例
            StreamWriter streamWriter = new StreamWriter(path);
        
            streamWriter.WriteLine("驱策的魂魄要");
            
            streamWriter.WriteLine("流浪哪条街");

            streamWriter.WriteLine("射落的纸鸢曾");

            streamWriter.WriteLine("飞过哪片月");
            streamWriter.WriteLine("磷灯点满城阙");
            streamWriter.WriteLine("照彻天不夜");
            

            streamWriter.Flush();//刷新缓存
            
            streamWriter.Close();//关闭流
        }
    }
}
